<template>
  <div id="main" />
</template>

<script>
// 引入 echarts 核心模块，核心模块提供了 echarts 使用必须要的接口。
import * as echarts from 'echarts'
export default {
  data() {
    return {

    }
  },

  created() {

  },

  mounted() {
    this.initEcharts()
  },

  methods: {
    // 初始化图表
    initEcharts() {
      // 基于准备好的dom，初始化echarts实例
      const myChart = echarts.init(document.getElementById('main'))
      // 准备数据
      const option = {
        title: {
          text: '内卷指数'
        },
        backgroundColor: '#333',
        legend: {
          data: ['Allocated Budget', 'Actual Spending']
        },
        radar: {
          // shape: 'circle',
          indicator: [
            { name: '加班', max: 100 },
            { name: '不要钱', max: 100 },
            { name: '给公司钱', max: 100 },
            { name: '全勤', max: 100 },
            { name: '帮助同事', max: 100 },
            { name: '拍马屁', max: 100 }
          ],
          splitLine: {
            lineStyle: {
              color: [
                'rgba(238, 197, 102, 0.1)',
                'rgba(238, 197, 102, 0.2)',
                'rgba(238, 197, 102, 0.4)',
                'rgba(238, 197, 102, 0.6)',
                'rgba(238, 197, 102, 0.8)',
                'rgba(238, 197, 102, 1)'
              ].reverse()
            }
          },
          splitArea: {
            show: false
          }
        },
        series: [
          {
            name: 'Budget vs spending',
            type: 'radar',
            color: ['red', 'blue', 'pink'],
            data: [
              {
                value: [100, 100, 0, 100, 0, 100],
                name: '小李'
              },
              {
                value: [30, 30, 30, 30, 0, 100],
                name: '小张'
              },
              {
                value: [50, 50, 50, 50, 50, 50],
                name: '老王'
              }
            ]
          }
        ]
      }
      // 绘制图表
      myChart.setOption(option)
    }
  }
}
</script>

<style scoped lang='scss'>
#main {
  width: 500px;
  height: 500px;
}
</style>
